feature: graphical visualizations for circuits#1239
Conversation
|
Points to note
Question
|
|
@rmshaffer can you guide me a little here. How can we proceed and define a timeline for review and any changes required. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1239 +/- ##
==========================================
Coverage 100.00% 100.00%
==========================================
Files 169 173 +4
Lines 10961 11373 +412
Branches 1412 1472 +60
==========================================
+ Hits 10961 11373 +412 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@skushagra could you share some images of the visualizations generated by your changes? (alternatively you could add a python script to for color scheme, I imagine defaulting to just black diagram on a white background would make sense at first. Eventually we could provide the user ways to customize this, although that's not a requirement. |
|
Hello, sorry for the delay. Was very busy over the last one month. Will pick this over the coming weekend and fix all issues pending here. Thanks |
|
Hi @skushagra thank you for the contribution! The visualization looks really great. I am trying to iterate on top of your changes and will let you know when we have a further request. |
sesmart
left a comment
There was a problem hiding this comment.
Generally this looks awesome :) I would just advocate for tighter spacing throughout, or easier controls for this.
| "A larger example showing how the renderer scales across many moments. This is a standard Quantum Fourier Transform on 5 qubits: Hadamards interleaved with controlled phase rotations, followed by bit-reversal swaps." | ||
| ] | ||
| }, | ||
| { |
There was a problem hiding this comment.
In this cell you can specify os.environ["BRAKET_DIAGRAM_WIDTH"]=135, which is more appropriate for Jupyter notebooks.
| "- Controls render as filled dots, anti-controls as open dots\n", | ||
| "- Multi-qubit gates draw a vertical connection line between their qubits\n", | ||
| "- SWAP renders as an `x` on each qubit, joined by a vertical line\n", | ||
| "- Barriers render as dashed vertical lines\n", |
There was a problem hiding this comment.
Can we remove the line between for Barrier? I actually think it's going to make it really hard when the barrier doesn't span intermediate qubits.
| "source": [ | ||
| "## 6. Verbatim boxes\n", | ||
| "\n", | ||
| "A verbatim box marks a subcircuit that the compiler must execute exactly as written, without optimization or rewriting. In the diagram, `StartVerbatim` and `EndVerbatim` render as labelled columns that bracket the protected region, connected by a vertical line across every qubit." |
There was a problem hiding this comment.
Can we make verbatim not a gate-like box? I think it is more clear generally as an instruction. Also for space I think we should come up with a shorthand, but I would do that for the Text diagram as well.
|
@yitchen-tim Thanks. I'll stay active on updates on this PR. Thanks. Let me know in case anyhting is required. |
|
@yitchen-tim Should I pick the reviewed changes or are you working on this? |
Issue #1083
Description of changes:
Testing done: Yes
Merge Checklist
Put an
xin the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your pull request.General
Tests
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.